Conversation
…ions - Remove redundant esp32 board string (variant + flash_size already present) - Add web_server version: 3 to Core.yaml - Remove platformio_options board_build.flash_mode from both device YAMLs - Remove legacy BLE wifi on_connect/on_disconnect hooks from PUMP-1.yaml
[esphome] Modernise board spec, web server v3, remove legacy options
[version] Add ESPHome and Apollo firmware version sensors
[wifi-info] Add IP address text sensor
Adds two new optional config switches (off by default): - Invert Water Logic: flips input sensor meaning so DRY = destination low = start pump, WET = destination full = stop pump - Auto Refill: automatically triggers pumpUntilFull when input sensor goes dry in inverted mode Resolves #22
When stop_pump_when_full is ON, the output sensor already handles full detection. Skip the inverted-mode input sensor stop to prevent the pump from stopping as water passes the low-level sensor on the way to full.
Bump version to 26.3.2.1
[cpap] Add invert water logic and auto refill for CPAP filling use case
The sensor was showing "unknown" because update_interval: never prevents the lambda from ever firing. Removing it allows the default 60s periodic update to publish the version string.
Fix Apollo Firmware Version sensor showing unknown
Per ESPHome dev feedback: the version is a compile-time constant, so publish it once on_boot rather than using a lambda with periodic updates.
Add text_sensor.template.publish for apollo_firmware_version at priority 500 to PUMP-1_Minimal for dashboard import users.
Fix: publish firmware version once on boot instead of polling
Adds a homeassistant.action logbook.log call in the fluid_input_sensor on_release handler so that HA logbook records when the pump is triggered automatically by the CPAP auto refill + invert water logic mode.
[cpap] Add logbook entry for auto refill trigger
Replaces the homeassistant.action logbook.log approach from #32 with an ESPHome event entity, which surfaces natively in the HA logbook without requiring API actions to be enabled on the device. Fires three event types: - auto_refill_triggered: CPAP auto refill + invert water logic triggers pump - pump_started: pump_control turns on and conditions are met - pump_stopped: pump_control turns off
pump_start_time is only set when the pump actually starts successfully. Checking != 0 before logging and emitting pump_stopped prevents false logbook entries when a start is rejected and switch.turn_off is called from the else branch of on_turn_on.
…tries ESPHome event entities show only a generic 'detected an event' string in the HA logbook. Replaces the Pump Activity event entity with a Last Pump Action text sensor whose state changes (Auto Refill Triggered, Pump Started, Pump Stopped) appear verbatim in the HA logbook.
[cpap] Add Last Pump Action text sensor for HA logbook
…switches Renames the switch name, id, and all 4 condition references from invert_water_logic to tank_refill_mode for clarity. Adds on_turn_on/on_turn_off handlers to auto-configure related switches: - Turn ON: Stop Pump When Output Wet → ON, Stop Pump When Input Dry → OFF - Turn OFF: Stop Pump When Output Wet → OFF, Stop Pump When Input Dry → ON
…de state on_turn_on/on_turn_off only fire when explicitly toggled, not on boot restore. Adds a priority -20 on_boot handler that reads tank_refill_mode and sets stop_pump_when_full and stop_pump_when_dry accordingly so all three switches are in sync after every reboot.
…witches [ux] Rename Invert Water Logic to Tank Refill Mode + auto-configure switches
|
Warning Review limit reached
More reviews will be available in 50 minutes and 40 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR introduces a refill mode feature to the ESPHome pump controller, enabling inverted pump logic with auto-refill automation. Core.yaml is significantly enhanced with new switches, pump control refactoring, auto-refill triggering, and safety enhancements. Device configs are updated to publish firmware versions at boot, and release drafter formatting is simplified. ChangesESPHome Refill Mode and Pump Control
Release Notes Configuration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
how can i get a copy of this firmware to try out on my pump? |
Thanks for your interest in our beta branch! Please follow this tutorial to get on the beta branch! https://wiki.apolloautomation.com/products/general/setup/switch-to-beta-branch/ |
|
This there a way to install without home assistant? I actually use Hubitat and wrote a driver for the pump there. I got it running just fine but would like to try the beta software. |
You can follow the steps from our new unreleased product here to test the esphome device builder app in windows, macos, etc I do not have step by step instructions at this time because it's an experimental beta app by the ESPHome project and still changing. Regarding Hubitat driver for pump-1, can you please share what you have done for this and how to duplicate it for others? We have a user who has beta drivers for some of our devices here: https://community.hubitat.com/t/beta-apollo-automation-air-1-driver/155982 |
Thanks I’ll check this out. As for the pump-1 driver I dropped the raw code in a reply in the thread. That way anyone can use it as they see fit. |
Fork-submitted PRs get a read-only token on pull_request runs, so the label and assignee bots fail with 403. pull_request_target runs in the base repo context with a write token; safe here because neither job checks out or executes PR code. Build jobs stay on pull_request. Trim ci.yml permissions to what the builds need.
The http_request update component polls every 6h and the first poll fires before the network is up, so a freshly booted device does not see an available update for up to 6 hours. Trigger a manifest check as soon as the network connects.
Home Assistant shows only the first 255 characters of an ESPHome release summary, so boilerplate is expensive and ## headings render oversized in the update dialog: - Render category titles and What's Changed in bold instead of H2 - Drop the star-the-repo footer - Drop the Full Changelog line: it semver-truncates 4-part versions (always links ...X.Y.Z.1) - the shared build workflow now appends a correct compare link instead
Fix firmware update entity being stale for 6h after boot
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Integrations/ESPHome/Core.yaml`:
- Around line 186-197: The bypass branch in pump_control → on_turn_on currently
allows pump start solely when switch.stop_pump_when_dry is off, which becomes
true whenever tank_refill_mode is enabled; modify that branch so the bypass
requires both stop_pump_when_dry to be off AND tank_refill_mode to be off (i.e.,
only allow the dry-protection bypass when tank_refill_mode is not active),
updating the or: branch that contains "- switch.is_off: stop_pump_when_dry" to
include an additional condition referencing "switch.is_off: tank_refill_mode".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c1d44723-1376-44b3-a31a-426f1653c747
📒 Files selected for processing (4)
.github/release-drafter.ymlIntegrations/ESPHome/Core.yamlIntegrations/ESPHome/PUMP-1.yamlIntegrations/ESPHome/PUMP-1_Minimal.yaml
| - switch.turn_on: stop_pump_when_full | ||
| - switch.turn_off: stop_pump_when_dry | ||
| - switch.turn_on: auto_refill | ||
| else: | ||
| - switch.turn_off: stop_pump_when_full | ||
| - switch.turn_on: stop_pump_when_dry |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="Integrations/ESPHome/Core.yaml"
# Show the exact snippet around the initially referenced lines (26-31)
echo "=== $FILE lines 1-80 ==="
nl -ba "$FILE" | sed -n '1,80p'
# Show the section around the other referenced range (152-200)
echo
echo "=== $FILE lines 120-200 ==="
nl -ba "$FILE" | sed -n '120,210p'
# Show the section around the referenced branch near 458-520
echo
echo "=== $FILE lines 430-520 ==="
nl -ba "$FILE" | sed -n '430,520p'
# Find all occurrences of stop_pump_when_full and show small context
echo
echo "=== Occurrences of stop_pump_when_full ==="
rg -n "stop_pump_when_full" "$FILE" || true
# For each is_off/is_on condition involving stop_pump_when_full, show a bit more context
echo
echo "=== Lines with switch.is_off/on: stop_pump_when_full ==="
rg -n "switch\.(is_off|is_on):\s*stop_pump_when_full" "$FILE" -n || true
# Show definition/booleans for stop_pump_when_full if present
echo
echo "=== Potential stop_pump_when_full entity definition (context) ==="
rg -n "(id:\s*stop_pump_when_full|name:\s*stop_pump_when_full|platform:|binary_sensor:|switch:)" "$FILE" || trueRepository: ApolloAutomation/PUMP-1
Length of output: 178
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="Integrations/ESPHome/Core.yaml"
if [ ! -f "$FILE" ]; then
echo "Missing file: $FILE"
exit 1
fi
show_range () {
local start="$1" end="$2"
echo "=== $FILE lines $start-$end ==="
awk -v s="$start" -v e="$end" 'NR>=s && NR<=e {printf "%6d %s\n", NR, $0}' "$FILE"
echo
}
show_range 1 80
show_range 120 210
show_range 430 520
echo "=== Occurrences of stop_pump_when_full ==="
rg -n "stop_pump_when_full" "$FILE" || true
echo
echo "=== Lines with switch.is_off/is_on: stop_pump_when_full ==="
rg -n "switch\.(is_off|is_on):\s*stop_pump_when_full" "$FILE" || true
echo
echo "=== Potential stop_pump_when_full entity definition (context) ==="
rg -n "(id:\s*stop_pump_when_full|name:\s*stop_pump_when_full)" "$FILE" || trueRepository: ApolloAutomation/PUMP-1
Length of output: 9824
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="Integrations/ESPHome/Core.yaml"
for term in "fluid_input_sensor" "fulid_output_sensor" "inverted" "destination full" "refill" "auto_refill" "pumpUntilFull" "pump_control" "fulid_output_sensor"; do
echo "=== rg $term ==="
rg -n "$term" "$FILE" || true
done
echo
echo "=== Show sensor-related sections (small ranges) ==="
# show a few nearby ranges around likely sensor ids
rg -n "binary_sensor:" "$FILE"
# print around first few matches of fluid_input_sensor
for l in $(rg -n "fluid_input_sensor" "$FILE" | cut -d: -f1 | head -n 5); do
start=$((l-15)); end=$((l+40));
echo "--- around line $l ($start-$end) ---"
awk -v s="$start" -v e="$end" 'NR>=s && NR<=e {printf "%6d %s\n", NR, $0}' "$FILE"
echo
done
# print around fulid_output_sensor occurrences
for l in $(rg -n "fulid_output_sensor" "$FILE" | cut -d: -f1 | head -n 5); do
start=$((l-15)); end=$((l+40));
echo "--- around line $l ($start-$end) ---"
awk -v s="$start" -v e="$end" 'NR>=s && NR<=e {printf "%6d %s\n", NR, $0}' "$FILE"
echo
doneRepository: ApolloAutomation/PUMP-1
Length of output: 17605
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="Integrations/ESPHome/Core.yaml"
echo "=== Context around additional stop_pump_when_full usage (~370-420) ==="
awk 'NR>=350 && NR<=430 {printf "%6d %s\n", NR, $0}' "$FILE"
echo
echo "=== Exact tank_full vs destination_full conditions in pump_safety_check (~430-475) ==="
awk 'NR>=430 && NR<=477 {printf "%6d %s\n", NR, $0}' "$FILE"Repository: ApolloAutomation/PUMP-1
Length of output: 5355
Inverted-mode “destination full” stop is gated on stop_pump_when_full: off, but refill mode turns stop_pump_when_full on by default—making that stop path unreachable unless the switch is manually disabled.
tank_refill_modeenablesstop_pump_when_full(on_boot: lines 26-31;on_turn_on: lines 150-154;pumpUntilFull: lines 388-393).- In
pump_safety_check, the inverted-mode “destination full” block requirestank_refill_modeandswitch.is_off: stop_pump_when_full(lines 458-466), so it won’t run in default refill mode; only the separate “tank full” check (output sensor, gated onstop_pump_when_full: on) can stop the pump.
One possible alignment
- - switch.is_off: stop_pump_when_full
+ - switch.is_on: stop_pump_when_full| or: | ||
| - binary_sensor.is_on: fluid_input_sensor | ||
| # Normal mode: input has water | ||
| - and: | ||
| - switch.is_off: tank_refill_mode | ||
| - binary_sensor.is_on: fluid_input_sensor | ||
| # Inverted mode: input is dry (destination is low, needs filling) | ||
| - and: | ||
| - switch.is_on: tank_refill_mode | ||
| - binary_sensor.is_off: fluid_input_sensor | ||
| # Bypass: dry protection not enabled | ||
| - switch.is_off: stop_pump_when_dry | ||
| then: |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="Integrations/ESPHome/Core.yaml"
echo "== Target file existence =="
ls -la "$FILE" || true
echo
echo "== Lines 150-230 =="
nl -ba "$FILE" | sed -n '140,240p'
echo
echo "== Find tank_refill_mode usages/definitions =="
rg -n "tank_refill_mode" "$FILE" || true
echo
echo "== Find stop_pump_when_dry usages/definitions =="
rg -n "stop_pump_when_dry" "$FILE" || true
echo
echo "== Show relevant start gating context (look for 'start'/'pump' 'dry' logic blocks) =="
rg -n -C 2 "(start|pump).*dry|dry.*(start|pump)|(tank_refill_mode|stop_pump_when_dry).*then:|on_press|on_boot|lambda|id:|condition:|or:|switch\.is_off|switch\.is_on" "$FILE" || trueRepository: ApolloAutomation/PUMP-1
Length of output: 259
🏁 Script executed:
#!/bin/bash
set -euo pipefail
FILE="Integrations/ESPHome/Core.yaml"
echo "== Lines 150-230 =="
awk 'NR>=150 && NR<=230 {printf "%d\t%s\n", NR, $0}' "$FILE"
echo
echo "== Find tank_refill_mode usages/definitions =="
rg -n "tank_refill_mode" "$FILE" || true
echo
echo "== Find stop_pump_when_dry usages/definitions =="
rg -n "stop_pump_when_dry" "$FILE" || true
echo
echo "== Context around OR branch near lines ~180-200 =="
awk 'NR>=170 && NR<=210 {printf "%d\t%s\n", NR, $0}' "$FILE"
echo
echo "== Find the 'pump start' gating logic block (best-effort search) =="
rg -n -C 3 "(pump|start).*condition:|condition:|or:|binary_sensor\.is_(on|off)|switch\.is_(on|off)" "$FILE" | head -n 200Repository: ApolloAutomation/PUMP-1
Length of output: 10325
Tank Refill Mode should not satisfy the “dry protection bypass” branch for pump start
In pump_control → on_turn_on, pump start is allowed when any or: branch is true, including - switch.is_off: stop_pump_when_dry. But when tank_refill_mode is enabled, stop_pump_when_dry is forced OFF, so this bypass branch becomes true and lets the pump start even when fluid_input_sensor indicates wet.
Suggested fix
- # Bypass: dry protection not enabled
- - switch.is_off: stop_pump_when_dry
+ # Bypass only in normal mode when dry protection is intentionally disabled
+ - and:
+ - switch.is_off: tank_refill_mode
+ - switch.is_off: stop_pump_when_dry📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| or: | |
| - binary_sensor.is_on: fluid_input_sensor | |
| # Normal mode: input has water | |
| - and: | |
| - switch.is_off: tank_refill_mode | |
| - binary_sensor.is_on: fluid_input_sensor | |
| # Inverted mode: input is dry (destination is low, needs filling) | |
| - and: | |
| - switch.is_on: tank_refill_mode | |
| - binary_sensor.is_off: fluid_input_sensor | |
| # Bypass: dry protection not enabled | |
| - switch.is_off: stop_pump_when_dry | |
| then: | |
| or: | |
| # Normal mode: input has water | |
| - and: | |
| - switch.is_off: tank_refill_mode | |
| - binary_sensor.is_on: fluid_input_sensor | |
| # Inverted mode: input is dry (destination is low, needs filling) | |
| - and: | |
| - switch.is_on: tank_refill_mode | |
| - binary_sensor.is_off: fluid_input_sensor | |
| # Bypass only in normal mode when dry protection is intentionally disabled | |
| - and: | |
| - switch.is_off: tank_refill_mode | |
| - switch.is_off: stop_pump_when_dry | |
| then: |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Integrations/ESPHome/Core.yaml` around lines 186 - 197, The bypass branch in
pump_control → on_turn_on currently allows pump start solely when
switch.stop_pump_when_dry is off, which becomes true whenever tank_refill_mode
is enabled; modify that branch so the bypass requires both stop_pump_when_dry to
be off AND tank_refill_mode to be off (i.e., only allow the dry-protection
bypass when tank_refill_mode is not active), updating the or: branch that
contains "- switch.is_off: stop_pump_when_dry" to include an additional
condition referencing "switch.is_off: tank_refill_mode".
Fix label-check and auto-assign on fork PRs
Version: 26.3.2.1
What does this implement/fix?
Merges beta into main for the 26.3.2.1 release. Changes include:
pumpUntilFullwhen input sensor goes dry in Tank Refill Mode; auto-toggles with Tank Refill Modewifi_infoplatformTypes of changes
Checklist / Checklijst:
If user-visible functionality or configuration variables are added/modified:
Summary by CodeRabbit
New Features
Updates